import React from 'react'
import centerCss from "../css/center.module.css"
import { useState, useEffect } from "react"
import axios from 'axios'
import { Link } from "react-router-dom"
function Center() {
  const [data, setdata] = useState([])
  useEffect(() => {
    axios("/lyq/center").then((res) => {
      setdata(res.data);
    })
  }, [])
  return (
    <div className={centerCss.info_top}>
      {data.map((item) => {
        return (
          <Link key={item.infoid} to={{ pathname: "/info/" + item.infoid }}>
            <div key={item.infoid}>
              <img src={item.infoimg} alt="" />
              <p>{item.title}</p>
            </div>
          </Link>
        )
      })}
    </div>
  )
}

export default Center
